<?php
/**
 * Prado Portal.
 *
 * @author Steen Rabol <steen.rabol@gmail.com>
 * @link http://www.pradoportal.dk/
 * @copyright Copyright &copy; 2006,2007,2008 Steen Rabol
 * @license http://www.pradoportal.dk
 * @version $Id: PortalTextHighlighter.php 289 2008-11-14 05:34:40Z steen.rabol@gmail.com $
 *
 */

/**
 *
 * @package Pradoportal.Common
 */
class PortalTextHighlighter extends TTextHighlighter
{
	/**
	 * @return boolean whether to Word wrap the highlighted result.
	 */
	public function getWordWrap()
	{
		return $this->getViewState('WordWrap', false);
	}

	/**
	 * @param boolean whether to Word wrap the highlighted result.
	 */
	public function setWordWrap($value)
	{
		$this->setViewState('WordWrap', TPropertyValue::ensureBoolean($value), false);
	}

	public function xxprocessText($text)
	{
		$geshi = new GeSHi(trim($text), $this->getLanguage());

		if($this->getShowLineNumbers())
			$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);

		$geshi->enable_classes();

		if($this->getEnableCopyCode())
			$geshi->set_header_content($this->getHeaderTemplate());

		if($this->getWordWrap())
			$geshi->set_header_type(1);

		return $geshi->parse_code();
	}

}
?>